<%-- 
    Document   : index
    Created on : Dec 13, 2014, 11:02:43 AM
    Author     : jostri
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><fmt:message key="logins" /></title>
    </head>
    <body>
        <div class="container">
            <h1><fmt:message key="logins" /></h1>

            <div>
                <a href="<c:url value="/useradministration/add"/>">
                    <img src="<c:url value="/resources/pictures/add.png" />" title="<fmt:message key="login.addNew" />" /> <fmt:message key="login.addNew" />
                </a>
            </div>
            <table class="table table-striped">
                <th>
                    <fmt:message key="login.user" />
                </th>
                <th>
                    <fmt:message key="login.enabled" />
                </th>
                <th>
                    <fmt:message key="login.role" />
                </th>
                <th>
                    <fmt:message key="edit" />
                </th>
                <th>
                    <fmt:message key="remove" />
                </th>
                <c:forEach var="u" items="${users}">
                    <tr>
                        <td>
                            <c:out value="${u.username}"/>
                        </td>
                        <td>
                            <c:if test="${u.enabled}">
                                <img src="<c:url value="/resources/pictures/allowed.png" />" title="<fmt:message key="login.enabled" />" />
                            </c:if>
                            <c:if test="${!u.enabled}">
                                <img src="<c:url value="/resources/pictures/disabled.gif" />" title="<fmt:message key="login.disabled" />" />
                            </c:if>
                        </td>
                        <td>
                            <fmt:message key="${u.role}" />
                        </td>
                        <td>
                            <a href="<c:url value="/useradministration/edit/${u.id}"/>">
                                <img src="<c:url value="/resources/pictures/edit.png" />" title="<fmt:message key="edit" />" /> <fmt:message key="edit" />
                            </a>
                        </td>
                        <td>
                            <a href="<c:url value="/useradministration/remove/${u.id}"/>" onclick="return confirm('<fmt:message key="remove.confirm" />')">
                                <img src="<c:url value="/resources/pictures/remove.png" />" title="<fmt:message key="remove" />" /> <fmt:message key="remove" />
                            </a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </body>
</html>
